<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<css file="__PUBLIC__/index/css/index.css" />
<js file="__PUBLIC__/jquery.js"/>
<script>
    var url = "__URL__";
    $(function(){
         $('.right_error').css({right:-170})
          var nbsp = /^\s*|\s*$/ig;
    $('.relay_btn').click(function(){
        var uname = $('.uname').val();
        var username = $('.username').val();
        var password = $('.password').val();
        username =username.replace(nbsp,'');
        //验证昵称是否为空
        uname = uname.replace(nbsp,'');
        password = password.replace(nbsp,'');
       if(uname==''){
            $('.error_content').html("请输入昵称");
             $('.right_error').css({top:0}).show();
             return false;
       }
        //验证用户名是否为空
        if(username==''){
            $('.error_content').html("请输入你的邮箱地址!");
            $('.right_error').css({top:50}).show();
            return false;
        }
        if(password==''){
            $('.error_content').html("密码不能为空!");
            $('.right_error').css({top:100}).show();
            return false;
        }
        var repg = /^[a-zA-Z0-9]{6,15}@\w+\.\w+$/ig;
        //验证格式是否正确
        if(!repg.exec(username)){
            $('.error_content').html("请输入正确的邮箱!");
            $('.right_error').css({top:50}).show();
            return false;
        }
        $.post(url+'/relayver',{
            'uname':uname,
            'username':username,
            'password':password
        },function(data){
           if(data.num==1){
                $('.error_content').html("昵称已存在");
                $('.right_error').css({top:0}).show();
                $('.uname').focus();
                return false;
           }else if(data.num==2){
               $('.error_content').html("邮箱地址已存在!");
              $('.right_error').css({top:50}).show();
               $('.username').focus();
              return false;
           }else{
               $('form').submit();
           }
        },'json')

    })
    })
</script>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <div class="all">
            <a href="__URL__/index" class="logo"></a>
            <div class="video"></div>
            <h3>欢迎你!完善下你的信息，以后你也可以使用该邮箱和密码来登录花瓣了。</h3>
            <div class="perfect">
                <div class="headimg">
                    <img src="__PUBLIC__/index/images/moreng.jpeg"/>
                </div>
                <div class="perfectname">
                    <form action="__URL__/relayuser" method="post">
                        <input type="text" name="uname" class="uname p" placeholder="昵称" autocomplete="off" style="margin:0"/>
                        <input type="text" name="username" class="username p" placeholder="邮箱登录地址" autocomplete="off"/>
                        <input type="password" name="password" class="password p" placeholder="密码" autocomplete="off"/>
                    </form>
                    <input type="button" value="提交" class="relay_btn" />
                        <div>
                            <div class="right_error">
                                <span class="arrow">◣</span>
                                <span class="error_content">请输入你的邮箱地址</span>
                            </div>
                        </div>
                </div>
            </div>
        </div>
    </body>
</html>
